{include file="public/toper" /}
<div class="x-nav">
    <span class="layui-breadcrumb">
        <a href="">运营中心管理</a>
        <a href="">缺货登记</a>
    </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">&#xe666;</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
            <input type="text" name="sreach" value=""  style="width:250px;" id="key"   placeholder="请输入商品名称或者用户名称" autocomplete="off" class="layui-input">
            <button class="layui-btn" id="search"><i class="layui-icon">&#xe615;</i></button>
        </div>
    </div>

    <table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="sj">
    {{#  if(d.notice_time==0){ }}无{{#  } else { }}<div>{{layui.util.toDateString(d.notice_time*1000)}}</div>{{#  } }}
</script>
<script>
    layui.use(['table','util'], function(){
        var table = layui.table, $ = layui.jquery;
        var layer = layui.layer;
        var loading = layer.load(1, {shade: [0.1,'#fff'] });
        var tableIn = table.render({
            method: 'post',
            elem: '#test'
            ,url: "{:url('Shortage/index')}"
            ,id:'test'
            ,cols: [[
                {field:'shortage_id', width:80, title: '序号',align: 'center',type:'numbers'}
                ,{field:'gname', width:200, title: '登记商品',align: 'center'}
                ,{field:'uname',width:180,title:'登记人',align:'center'}
                ,{field:'content', width:500, title: '内容',align: 'center'}
                ,{field:'state', width:180, title: '通知结果',align: 'center',templet: function(d){if(d.state==0){return '成功';}else if(d.state==1){return '失败'; }else if(d.state==2){ return '待通知'; }}}
                ,{field: 'notice_time',width: 180, sort:'true',title: '通知时间', templet: '#sj',align: 'center'}
                ,{field: 'create_time',width: 180, sort:'true',title: '登记时间', templet: '<div>{{layui.util.toDateString(d.create_time*1000) }}</div>',align: 'center'}
            ]]
            ,page: true
            ,limit: 30
            ,limits:[30,60,90,120,150,180,210,240,270,300]
        });
        layer.close(loading);


        //搜索
        $('#search').on('click', function () {
            tableIn.reload({
                where: {key: $('#key').val()}
                ,page: {
                    curr: 1
                }
            });
        });
    });
</script>
{include file="public/footer"/}